/*
Copyright 2022 The Numaproj Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Code generated by Openapi Generator. DO NOT EDIT.

/// RateLimiterOnlyIfUsed : RateLimiterOnlyIfUsed is for the OnlyIfUsed mode. Releases additional tokens only when previously released tokens have been utilized above the configured threshold

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RateLimiterOnlyIfUsed {
    /// ThresholdPercentage specifies the minimum percentage of capacity, availed by the rate limiter, that should be consumed at any instance to allow the rate limiter to unlock additional capacity.  Defaults to 50%  For example, given the following configuration: - max = 100 - min = 10 - rampUpDuration = 10s i.e.--> slope = 10 messages/second - thresholdPercentage = 50 at t = 0, the rate limiter will release 10 messages and at least 5 of those should be consumed to unlock additional capacity of 10 messages at t = 1 to make the total capacity of 20.
    #[serde(
        rename = "thresholdPercentage",
        skip_serializing_if = "Option::is_none"
    )]
    pub threshold_percentage: Option<i64>,
}

impl RateLimiterOnlyIfUsed {
    /// RateLimiterOnlyIfUsed is for the OnlyIfUsed mode. Releases additional tokens only when previously released tokens have been utilized above the configured threshold
    pub fn new() -> RateLimiterOnlyIfUsed {
        RateLimiterOnlyIfUsed {
            threshold_percentage: None,
        }
    }
}
